import type { Metadata } from "next"; import Link from "next/link"; import { notFound, permanentRedirect } from "next/navigation"; import { getLocale } from "@/lib/i18n/server"; import { fmtDate, href, t } from "@/lib/i18n"; import { getPaper } from "@/lib/papers/queries"; import { parseIdentifier } from "@/lib/papers/identifiers"; import { AuthorsLine } from "@/components/paper-items"; export async function generateMetadata({ params }: { params: Promise<{ id: string; version: string }> }): Promise { const { id, version } = await params; const p = await getPaper(id); return p ? { title: `${p.identifier} ${version} · ${p.title}`, alternates: { canonical: `/papers/${p.slug}` }, robots: { index: false, follow: true } } : {}; } export default async function VersionPage({ params }: { params: Promise<{ id: string; version: string }> }) { const { id, version } = await params; const locale = await getLocale(); const d = t(locale); const m = /^v(\d+)$/i.exec(version); if (!m) notFound(); const parsed = parseIdentifier(id); if (parsed && parsed.slug !== id) permanentRedirect(`/papers/${parsed.slug}/${version.toLowerCase()}`); const p = await getPaper(id); if (!p) notFound(); const v = p.versions.find((x) => x.version_no === Number(m[1])); if (!v) notFound(); return (

{p.identifier} · {v.label}{v.is_current ? ` · ${d.paper.versionTable.current}` : ""}

{p.title}

{d.paper.versionTable.version}
{v.label} (#{v.version_no})
{d.paper.versionTable.date}
{fmtDate(locale, v.released_on, v.released_precision as "day" | "month" | "year") || "—"}
{d.paper.versionTable.description}
{locale === "fr" ? v.description_fr ?? v.description : v.description}
{d.paper.pagesLabel}
{v.pages ?? "—"}
{d.paper.sha}
{v.sha256 ?? "—"}
{v.withdrawn ?

{d.paper.versionTable.withdrawn}{v.withdrawn_reason ? ` — ${v.withdrawn_reason}` : ""}

: v.file_id ? {d.paper.download} ({v.label}) : null}

← {d.misc.back}

); }